package com.zhang.demo.spring.bean;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;

import java.util.StringJoiner;

public class User {


    private String username;

    private String password;

    private int age;

    @Autowired
    @Qualifier("userAttr")
    private UserAttr userAttr;

    @Autowired
    private UserInfo userInfo;

    private Message message;

    public User(String username, String password, int age, Message message) {
        this.username = username;
        this.password = password;
        this.age = age;
        this.message = message;
    }

    public User(String username, String password, int age, UserAttr userAttr) {
        this.username = username;
        this.password = password;
        this.age = age;
        this.userAttr = userAttr;
    }

    public User(String username, String password, int age) {
        this.username = username;
        this.password = password;
        this.age = age;
    }

    public User() {
    }


    public Message getMessage() {
        return message;
    }

    public void setMessage(Message message) {
        this.message = message;
    }

    public UserAttr getUserAttr() {
        return userAttr;
    }

    public void setUserAttr(UserAttr userAttr) {
        this.userAttr = userAttr;
    }

    public UserInfo getUserInfo() {
        return userInfo;
    }

    public void setUserInfo(UserInfo userInfo) {
        this.userInfo = userInfo;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    @Override
    public String toString() {
        return new StringJoiner(", ", User.class.getSimpleName() + "[", "]")
                .add("username='" + username + "'")
                .add("password='" + password + "'")
                .add("age=" + age)
                .add("userAttr=" + userAttr)
                .add("userInfo=" + userInfo)
                .add("message=" + message)
                .toString();
    }
}
